package com.summer.ChengXuYuanMianShiJingDian;

public class weilaiTest1 {
    public static void main(String[] args) {
        int[] ints = new int[]{3,1,2,2,2,1,3};
        System.out.println(countPairs(ints,2));

    }
    public static int countPairs(int[] nums, int k) {
        int count = 0;
        for(int i = 0;i<nums.length;i++){
            for (int j =nums.length-1;j>i;j--){
                if (nums[i]==nums[j]&&((i*j)%k==0)) count++;
            }
        }
        return count;
    }
}
